<?php

/**
 * Assignee form base class.
 *
 * @method Assignee getObject() Returns the current form's model object
 *
 * @package    digitalform
 * @subpackage form
 * @author     Saul Santiago
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseAssigneeForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'application_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ApplicationCorporateManaged'), 'add_empty' => false)),
      'name'                   => new sfWidgetFormInputText(),
      'subscription'           => new sfWidgetFormInputText(),
      'addon_service1'         => new sfWidgetFormInputText(),
      'addon_service2'         => new sfWidgetFormInputText(),
      'addon_service3'         => new sfWidgetFormInputText(),
      'addon_service4'         => new sfWidgetFormInputText(),
      'addon_service5'         => new sfWidgetFormInputText(),
      'device_model'           => new sfWidgetFormInputText(),
      'device_base_price'      => new sfWidgetFormInputText(),
      'device_payment_scheme'  => new sfWidgetFormInputText(),
      'total_msf'              => new sfWidgetFormInputText(),
      'idd'                    => new sfWidgetFormInputCheckbox(),
      'international_roaming'  => new sfWidgetFormInputCheckbox(),
      'gprs_mobile_data'       => new sfWidgetFormInputCheckbox(),
      'services_others'        => new sfWidgetFormInputText(),
      'renewal_account_number' => new sfWidgetFormInputText(),
      'renewal_mobile_number'  => new sfWidgetFormInputText(),
      'created_at'             => new sfWidgetFormDateTime(),
      'updated_at'             => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'application_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ApplicationCorporateManaged'))),
      'name'                   => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'subscription'           => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'addon_service1'         => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'addon_service2'         => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'addon_service3'         => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'addon_service4'         => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'addon_service5'         => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'device_model'           => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'device_base_price'      => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'device_payment_scheme'  => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'total_msf'              => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'idd'                    => new sfValidatorBoolean(array('required' => false)),
      'international_roaming'  => new sfValidatorBoolean(array('required' => false)),
      'gprs_mobile_data'       => new sfValidatorBoolean(array('required' => false)),
      'services_others'        => new sfValidatorPass(array('required' => false)),
      'renewal_account_number' => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'renewal_mobile_number'  => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'created_at'             => new sfValidatorDateTime(),
      'updated_at'             => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('assignee[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Assignee';
  }

}
